<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<html>
<head>
<title>家长绑定管理</title>
<meta name="decorator" content="default" />
<%@ include file="/WEB-INF/views/include/dialog.jsp"%>
<script type="text/javascript">
	$(document).ready(function() { 
		$("#btnImport").click(function(){
			$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true}, 
				bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
		});
	});
	function page(n, s) {
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	};
	function openDialog(ddId){
    	//alert(ddId)
    	$("#ddId").val(ddId);
		$("#dialog").dialog({
		bgiframe: true,
        resizable: true, //是否可以重置大小
        height: 150, //高度
        width: 350, //宽度
        draggable: false, //是否可以拖动。
        title: "审核",
        modal: true,
        show : {
			effect : 'drop',
			direction : 'up'
		}
		});
	};
	function openIframe(ddId,type){
		var titl="";
		if(type == 1){
			$("#roll").attr("src","${ctx}/dd/ddParent/form?id=" + ddId);
			titl="家长信息";
		}else if(type == 2){
			$("#roll").attr("src","${ctx}/dd/ddSchoolRoll/form?id=" + ddId); 
			titl="学籍信息";
		}
		$("#iframe").dialog({
		bgiframe: true,
        resizable: true, //是否可以重置大小
        height: 500, //高度
        width: 626, //宽度
        draggable: false, //是否可以拖动。
        title: titl,
        modal: true,
        show : {
			effect : 'drop',
			direction : 'up'
		}
		});
	};
</script>
</head>
<body>

<div id="importBox" class="hide">
		<form id="importForm" action="${ctx}/sys/user/import" method="post" enctype="multipart/form-data"
			class="form-search" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入，请稍等...');"><br/>
			<input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>　　
			<input id="btnImportSubmit" class="btn btn-primary" type="submit" value="   导    入   "/>
			<a href="${ctx}/sys/user/import/template">下载模板</a>
		</form>
	</div>
	
	
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/dd/ddParentBind/parent/list">家长绑定列表</a></li>
		<shiro:hasPermission name="dd:ddParentBind:edit">
			<%-- <li><a href="${ctx}/dd/ddParentBind/form">添加</a></li> --%>
		</shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="ddParentBind"
		action="${ctx}/dd/ddParentBind/parent/list" method="post"
		class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
		<input id="pageSize" name="pageSize" type="hidden"
			value="${page.pageSize}" />
		<ul class="ul-form">
			<li><label>家长姓名：</label> <form:input path="parentName"
					htmlEscape="false" maxlength="50" class="input-medium" /></li>
			<li><label>身份证号码：</label> <form:input path="idCard"
					htmlEscape="false" maxlength="50" class="input-medium" /></li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary"
				type="submit" value="查询" />
				<input id="btnImport" class="btn btn-primary" type="button" value="导入"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}" />
	<table id="contentTable"
		class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>家长姓名</th>
				<!-- <th>微信ID</th>
				<th>家长ID</th> -->
				<th>学生学籍号</th>
				<th>手机号码</th>
				<th>身份证号码</th>
				<th>关系</th>
				<th>状态</th>
				<shiro:hasPermission name="dd:ddParentBind:edit">
					<th>操作</th>
				</shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${page.list}" var="ddParentBind">
				<tr>
					<td><c:if test="${not empty ddParentBind.parentId}">
							<a href="${ctx}/dd/ddParent/form?id=${ddParentBind.parentId}" 
								title="查看家长"> ${ddParentBind.parentName}</a>
						</c:if> <c:if test="${empty ddParentBind.parentId}"> 
						${ddParentBind.parentName}
						</c:if></td>
					<%--<td>${ddParentBind.weinxinId}</td>
					 <td>
					<c:if test="${not empty ddParentBind.parentId}">
						${ddParentBind.parentId}
					</c:if> <c:if test="${empty ddParentBind.parentId}"> 
						<span style="color:red;font-weight:bolder;text-align:center;">家长暂不存在</span>
					</c:if>
					</td> --%>
					<td><a href="${ctx}/dd/ddSchoolRoll/form?id=${ddParentBind.schoolRollId}"  title="查看学籍">
					${fns:getStudentNameBySchoolRoll(ddParentBind.schoolRollId)}</a>
					</td>
					<td>${ddParentBind.mobile}</td>
					<td>${ddParentBind.idCard}</td>
					<td>
					${fns:getDictLabel(ddParentBind.relationship, 'relationship',"空")}
					</td>
					<td>
					${fns:getDictLabel(ddParentBind.status, 'status',2)}
					</td>
					<shiro:hasPermission name="dd:ddParentBind:edit">
						<td><%-- <a href="${ctx}/dd/ddParentBind/form?id=${ddParentBind.id}"
							title="修改">修改</a> --%>
							<a href="${ctx}/dd/ddParentBind/delete?id=${ddParentBind.id}" title="删除"
							onclick="return confirmx('确认要删除该单表吗？', this.href)">删除</a>
							<c:if test="${ddParentBind.status==2}">
							<a href="javascript:;" onclick="openDialog('${ddParentBind.id}');" title="审核">审核</a>
							</c:if>
							<%-- <c:if test="${not empty ddParentBind.parentId}">
							<a href="javascript:;" onclick="openIframe('${ddParentBind.parentId}',1);"
							title="查看家长">查看家长</a>
							</c:if> --%>
						</td>
					</shiro:hasPermission>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>



	<div style="display:none;overflow:hidden;padding:3px" id="dialog">
		<form class="form-horizontal" role="form" id="f_bind"
			action="${ctx}/dd/ddParentBind/isPass" method="post">
			<div class="clearfix" style="height: 20px"></div>
			<input type="hidden" id="ddId" name="ddId"/>
			<div class="control-group">
				<label class="control-label"><b
					style="color: red; font-size: large">*</b>审核:</label> &nbsp; 
				<select id="status" name="status">
					<option value="0">通过</option>
					<option value="1">未通过</option>
				</select>
			</div>
					
			<div class="clearfix" style="height: 10px"></div>
			<div class="control-group" style="width: 15%; margin:auto;">
				<input type="submit" id="bindSubmit" class="" value="提交" />
			</div>
		</form>
	</div>
	
	<div style="display:none;overflow:hidden;padding:3px" id="iframe">
		<iframe frameborder="no" border="0" marginwidth="0" marginheight="0"
			id="roll" scrolling="auto" width="100%" height="100%"></iframe>
	</div>
</body>
</html>